#ifndef USBGPS_H
#define USBGPS_H

#include <QObject>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include "file/fdebug.h"
#include <QtPositioning/QNmeaPositionInfoSource>
#include <QtPositioning/QGeoPositionInfo>
#include "global_defines.h"

class USBGPS : public QObject
{
    Q_OBJECT
public:
    explicit USBGPS(QObject *parent = nullptr);


signals:
    void USBGPSPortMessage(QString str);
    void USBGPSPort_Latitude(double latitude);
    void USBGPSPort_Longitude(double longitude);

public slots:
    void on_acquireBtn_clicked();
private slots:

    void nmeaPositionUpdated(QGeoPositionInfo posiInfo);
    void nmeaPositionUpdateTimeOut();
    void nmeaPositionUpdateError(QGeoPositionInfoSource::Error errorMsg);

    void on_getPositionBtn_clicked();

private:

    QSerialPort *comPort;
    QNmeaPositionInfoSource *nmeaPosition;
    QGeoPositionInfo *positionInfo;
};

#endif // USBGPS_H
